import api from '../../js/api.js';
import { message } from 'antd';

export const getGoodsList = (num) => async dispatch => {
    const a = await api.post('/list',{page:1})
    if(a.success){
        console.error('num:'+num)
        dispatch(getList(a))
    }else{
        message.error(a.message)
    }
}
const getList = (result) =>{
    const list = result.data.list
    return {
        type:'GETLIST',
        count:list.length,
        list:list
    } 
}
export const getTitle = () => async dispatch => {
    const a = await api.get('/index')
    dispatch(
        {
            type:'GETTITLE',
            title:a.title,
        } 
    )
}
